package com.wits.qso.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.wits.platform.entity.User;
import com.wits.platform.service.BaseService;
import com.wits.qso.dao.VmUserDao;
import com.wits.qso.entity.Vm;
import com.wits.qso.entity.VmUser;

@Component
public class VmUserService extends BaseService<VmUser, String>
{
	private VmUserDao vmUserDao = null;

	/**
	 * 注入班级dao
	 * @param clsDao
	 */
	@Autowired
	public void setVmUserDao(VmUserDao vmUserDao) {
		this.baseDao = vmUserDao;
		this.vmUserDao = vmUserDao;		
	}
	
	
	/**
	 * 查询一个班级下学生的虚拟机信息
	 * @param clsId 班级id
	 * @param limit 结果数量
	 * @return
	 */
	public List<VmUser> findByClassIdAndLimit(String clsId, int limit) {
		// TODO Auto-generated method stub
		return vmUserDao.findByClassIdAndLimit(clsId,limit);
	}


	/**
	 * 根据用户id集合查询
	 * @param userIdList
	 * @return
	 */
	public List<VmUser> findByUserId(List<String> userIdList) {
		return vmUserDao.findByUserId(userIdList);
	}


	public VmUser findByUserId(String userId) {
		return vmUserDao.findByUserId(userId);
	}
	
	public List<User> findExistedUser() {
		return vmUserDao.findExistedUser();
	}
	
	public List<Vm> findExistedVm() {
		return vmUserDao.findExistedVm();
	}
}
